if(!userObj)
    var userObj = {
        init : function(){
            $('#userGride').datagrid({
                toolbar: [{
                    iconCls: 'icon-edit',
                    text : '新增',
                    handler: function(){userObj.openUser();}
                },'-',{
                    iconCls: 'icon-help',
                    text : '编辑',
                    handler: function(){userObj.openUser();}
                }],
                url:path + 'queryuser',
                columns:[[
                    {field:'name',title:'姓名',width:200},
                    {field:'sex',title:'性别',width:200,
                        formatter: function(value,row,index){
                            if (value == '1'){
                                return "男";
                            } else {
                                return "女";
                            }
                        }
                    },
                    {field:'mobile',title:'联系方式',width:200},
                    {field:'mobile',email:'邮件地址',width:200}
                ]],
                fitColumns : true,
                pagination : true,
                pagePosition : 'bottom',
                pageNumber : 1,
                pageSize : 30,
                pageList : [10,20,30,40,50]
            });

        },
        openUser : function () {
            $('#userAdd').dialog({
                closed:false,
                width:600,
                height:400,
                modal:true,
                cache: false
            });
        },
        addUser : function () {
            $.ajax({
                url : path + 'adduser',
                data : {"username" : $("#username").val(),"name" : $("#name").val(),"email" : $("#name").val(),"sex":$("#sex").val(),"password":$("#password").val()},
                type : "post",
                error : function(){

                },
                success : function(data){

                }
            });
        }
    }

$(function(){
   userObj.init();
})
